<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<title>class Bundler::Thor::Shell::HTML - bundler: Ruby Standard Library Documentation</title>


<script src="../../../js/navigation.js" defer></script>
<script src="../../../js/search.js" defer></script>
<script src="../../../js/search_index.js" defer></script>
<script src="../../../js/searcher.js" defer></script>
<script src="../../../js/darkfish.js" defer></script>

<script src="../../../js/jquery-3.2.0.min.js"></script>

<script src="../../../js/vue.min.js"></script>
<script src="../../../js/js.cookie.min.js"></script>

<link href="../../../css/fonts.css" rel="stylesheet">
<link id='rdoccss' href="../../../css/rdoc.css" rel="stylesheet">
<link href="../../../css/carbon17.css" rel="stylesheet">

<script type="text/javascript">
  var rdoc_rel_prefix = "../../../";
  var index_rel_prefix = "../../../";
  var darkModeCsseHref = "../../../css/rdoc-dm.css"
  var defaultModeCssHref = "../../../css/rdoc.css"
  // var cssDarkmode = Cookies.get('darkmode');
  
  if( Cookies.get("darkmode") == "true") {
	$('#rdoccss').attr("href", darkModeCsseHref);
}

//  https://cssdeck.com/blog/simple-jquery-stylesheet-switcher/

document.write('<style type="text/css">body{display:none}</style>');

</script>


</head>
<body id="top" role="document" class="class">
  <!-- this is class.html -->

  <div id='actionbar' >
    <div class='wrapper mdiv'>
      <ul class='grids g0'></ul>
    </div> 
    <!-- VERSION HEADER for 3.3.0.preview2 NOT FOUND -->
  </div> <!-- end action bar -->

  <div class='wrapper hdiv'>

    


    <nav id='vapp' role="navigation">
    <div id="project-navigation">
      <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2><a href="../../../index.html" rel="home">Home</a></h2>

  <div id="table-of-contents-navigation"  >
    <a href="../../../table_of_contents.html#pages">Pages</a>
    <a href="../../../table_of_contents.html#classes">Classes</a>
    <a href="../../../table_of_contents.html#methods">Methods</a>
  </div>
</div>

      <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

    </div>


    

    <button id='toggleThing' @click="toggleNav()" >Show/hide navigation</button>
    <div :class="isOpen ? 'block' : 'hidden' " id='toggleMe'>
      <div id="class-metadata">
        
        
<div id="parent-class-section" class="nav-section">
  <h3>Parent</h3>

  <p class="link"><a href="Basic.html">Bundler::Thor::Shell::Basic</a>
</div>

        
        
        
<!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
  <h3>Methods</h3>

  <ul class="link-list" role="directory">
    <li ><a href="#method-i-ask">#ask</a>
    <li ><a href="#method-i-can_display_colors-3F">#can_display_colors?</a>
    <li ><a href="#method-i-set_color">#set_color</a>
  </ul>
</div>

      </div>
     </div>
    </nav>


    <div id='extraz'><div class='adzbox-index'  >
      
     </div>         
    </div>

    <main role="main" aria-labelledby="class-Bundler::Thor::Shell::HTML">
    <h1 id="class-Bundler::Thor::Shell::HTML" class="class">
      class Bundler::Thor::Shell::HTML
    </h1>

    <section class="description">
    
<p>Inherit from <a href="Basic.html"><code>Bundler::Thor::Shell::Basic</code></a> and add <a href="HTML.html#method-i-set_color"><code>set_color</code></a> behavior. Check <a href="Basic.html"><code>Bundler::Thor::Shell::Basic</code></a> to see all available methods.</p>

    </section>

      <section id="5Buntitled-5D" class="documentation-section">


      <section class="constants-list">
      <header>
      <h3>Constants</h3>
      </header>
      <dl>
          <dt id="BLACK">BLACK
          <dd><p>Set the terminal’s foreground <a href="HTML.html"><code>HTML</code></a> color to black.</p>
          <dt id="BLUE">BLUE
          <dd><p>Set the terminal’s foreground <a href="HTML.html"><code>HTML</code></a> color to blue.</p>
          <dt id="BOLD">BOLD
          <dd><p>The start of an <a href="HTML.html"><code>HTML</code></a> bold sequence.</p>
          <dt id="CYAN">CYAN
          <dd><p>Set the terminal’s foreground <a href="HTML.html"><code>HTML</code></a> color to cyan.</p>
          <dt id="GREEN">GREEN
          <dd><p>Set the terminal’s foreground <a href="HTML.html"><code>HTML</code></a> color to green.</p>
          <dt id="MAGENTA">MAGENTA
          <dd><p>Set the terminal’s foreground <a href="HTML.html"><code>HTML</code></a> color to magenta.</p>
          <dt id="ON_BLACK">ON_BLACK
          <dd><p>Set the terminal’s background <a href="HTML.html"><code>HTML</code></a> color to black.</p>
          <dt id="ON_BLUE">ON_BLUE
          <dd><p>Set the terminal’s background <a href="HTML.html"><code>HTML</code></a> color to blue.</p>
          <dt id="ON_CYAN">ON_CYAN
          <dd><p>Set the terminal’s background <a href="HTML.html"><code>HTML</code></a> color to cyan.</p>
          <dt id="ON_GREEN">ON_GREEN
          <dd><p>Set the terminal’s background <a href="HTML.html"><code>HTML</code></a> color to green.</p>
          <dt id="ON_MAGENTA">ON_MAGENTA
          <dd><p>Set the terminal’s background <a href="HTML.html"><code>HTML</code></a> color to magenta.</p>
          <dt id="ON_RED">ON_RED
          <dd><p>Set the terminal’s background <a href="HTML.html"><code>HTML</code></a> color to red.</p>
          <dt id="ON_WHITE">ON_WHITE
          <dd><p>Set the terminal’s background <a href="HTML.html"><code>HTML</code></a> color to white.</p>
          <dt id="ON_YELLOW">ON_YELLOW
          <dd><p>Set the terminal’s background <a href="HTML.html"><code>HTML</code></a> color to yellow.</p>
          <dt id="RED">RED
          <dd><p>Set the terminal’s foreground <a href="HTML.html"><code>HTML</code></a> color to red.</p>
          <dt id="WHITE">WHITE
          <dd><p>Set the terminal’s foreground <a href="HTML.html"><code>HTML</code></a> color to white.</p>
          <dt id="YELLOW">YELLOW
          <dd><p>Set the terminal’s foreground <a href="HTML.html"><code>HTML</code></a> color to yellow.</p>
        </dl>
        </section>



                <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Instance Methods</h3>
                </header>

                  <div id="method-i-ask" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">ask</span><span
                                class="method-args">(statement, color = nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Ask something to the user and receives a response.</p>

<h4 id="method-i-ask-label-Example">Example<span><a href="#method-i-ask-label-Example">&para;</a> <a href="#top">&uarr;</a></span></h4>

<p>ask(“What is your name?”)</p>

<p>TODO: Implement <a href="HTML.html#method-i-ask"><code>ask</code></a> for <a href="HTML.html"><code>Bundler::Thor::Shell::HTML</code></a></p>

                              <div class="method-source-code" id="ask-source">
            <pre><span class="ruby-comment"># File bundler/vendor/thor/lib/thor/shell/html.rb, line 70</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">ask</span>(<span class="ruby-identifier">statement</span>, <span class="ruby-identifier">color</span> = <span class="ruby-keyword">nil</span>)
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">NotImplementedError</span>, <span class="ruby-string">&quot;Implement #ask for Bundler::Thor::Shell::HTML&quot;</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-set_color" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">set_color</span><span
                                class="method-args">(string, *colors)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Set color by using a string or one of the defined constants. If a third option is set to true, it also adds bold to the string. This is based on Highline implementation and it automatically appends CLEAR to the end of the returned String.</p>

                              <div class="method-source-code" id="set_color-source">
            <pre><span class="ruby-comment"># File bundler/vendor/thor/lib/thor/shell/html.rb, line 51</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">set_color</span>(<span class="ruby-identifier">string</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">colors</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">colors</span>.<span class="ruby-identifier">all?</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">color</span><span class="ruby-operator">|</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Symbol</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>) }
    <span class="ruby-identifier">html_colors</span> = <span class="ruby-identifier">colors</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">color</span><span class="ruby-operator">|</span> <span class="ruby-identifier">lookup_color</span>(<span class="ruby-identifier">color</span>) }
    <span class="ruby-node">&quot;&lt;span style=\&quot;#{html_colors.join(&#39;; &#39;)};\&quot;&gt;#{Bundler::Thor::Util.escape_html(string)}&lt;/span&gt;&quot;</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">color</span>, <span class="ruby-identifier">bold</span> = <span class="ruby-identifier">colors</span>
    <span class="ruby-identifier">html_color</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">const_get</span>(<span class="ruby-identifier">color</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">upcase</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Symbol</span>)
    <span class="ruby-identifier">styles</span> = [<span class="ruby-identifier">html_color</span>]
    <span class="ruby-identifier">styles</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">BOLD</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">bold</span>
    <span class="ruby-node">&quot;&lt;span style=\&quot;#{styles.join(&#39;; &#39;)};\&quot;&gt;#{Bundler::Thor::Util.escape_html(string)}&lt;/span&gt;&quot;</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="protected-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Protected Instance Methods</h3>
                </header>

                  <div id="method-i-can_display_colors-3F" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">can_display_colors?</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="can_display_colors-3F-source">
            <pre><span class="ruby-comment"># File bundler/vendor/thor/lib/thor/shell/html.rb, line 76</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">can_display_colors?</span>
  <span class="ruby-keyword">true</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

              </section>
              </main>



            </div>  <!--  class='wrapper hdiv' -->


<footer id="validator-badges" role="contentinfo">
<p><a href="https://validator.w3.org/check/referer">Validate</a></p>
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.</p>
<p>Based on <a href="https://github.com/ged/darkfish/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.</p>

  
    <p><p><a href="https://ruby-doc.org">Ruby-doc.org</a> is provided by <a href="https://jamesbritt.com">James Britt</a> and <a href="https://neurogami.com">Neurogami</a>.</p><p><a href="https://jamesbritt.bandcamp.com/">Maximum R+D</a>.  </p>
</p>
  
  </footer>

<script type="text/javascript">


  let ads  = $("#carbonads-container").children().detach();


  function swapMode() {
    var cookieName = 'darkmode';
    var cssDarkmode = Cookies.get(cookieName);
    console.log("***** swapMode! " + cssDarkmode + " *****");


    if (cssDarkmode == "true") {
      console.log("We have dark mode, set the css to light ...");
      $('#rdoccss').attr("href", defaultModeCssHref);
      $('#cssSelect').text("Dark mode");
      cssDarkmode = "false";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    } else {
      console.log("We not have dark mode, set the css to dark ...");
      $('#rdoccss').attr("href", darkModeCsseHref);
      $('#cssSelect').text("Light mode");
      cssDarkmode = "true";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    }

    console.log("  --------------- ");
  }


const vueCssApp = new Vue({
el: '#menubar',
data: {
isDark: false
},
methods: {
toggleClass: function(event){
this.isDark = !this.isDark;
}
}
})

const vueApp = new Vue({
el: '#vapp',
data: { 
isOpen: true
},

mounted() {
this.handleResize();
this.manage_mob_classes();
window.addEventListener('resize', this.handleResize)
//this.isOpen !=  (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},
destroyed() {
window.removeEventListener('resize', this.handleResize)
},
created() {
//manage_mob_classes();
},

methods : {
isMobile() {
  return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},

  handleResize() {
    if (!this.isMobile()) {
      this.isOpen = window.innerWidth > 800;
    }
  },

  manage_mob_classes() {
    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
      $("nav").addClass("mob_nav");
      $("main").addClass("mob_main");
      $("#extraz").addClass("mob_extraz");
      $("#carbonads-container").addClass("mob_carbonads-container");
      this.isOpen  = false;
    } else {
      $("nav").removeClass("mob_nav") 
        $("main").removeClass("mob_main");
      $("#extraz").removeClass("mob_extraz");
      $("#carbonads-container").removeClass("mob_carbonads-container");
      this.isOpen  = true;
    }
  },

  toggleNav() {
    this.isOpen =! this.isOpen ;
    // alert("Toggle nav!");
    console.log("toggleNav() click: " + this.isOpen );
  }
}
})

$("#carbonads-container").append(ads);


$(function() {

    var darkmode = Cookies.get("darkmode");
    console.log("Document ready: " + darkmode);

    if ( darkmode  == "true" ) {
      $('#cssSelect').text("Light mode");
    } else {
      $('#cssSelect').text("Dark mode");
     }

    $('body').css('display','block');
    });

</script>

    
  </body> 
</html>

